//
//  XSJCancellationTableCell.m
//  ZF
//
//  Created by apple on 2019/3/5.
//  Copyright © 2019 hyy. All rights reserved.
//

#import "XSJCancellationTableCell.h"

@interface XSJCancellationTableCell()

@end

@implementation XSJCancellationTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self setup];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setup
{
    self.contentView.backgroundColor = TableViewBGColor;
    [self.contentView addSubview:self.cancellButton];
    
    [_cancellButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.mas_equalTo(20);
        make.width.mas_equalTo(285);
        make.height.mas_equalTo(40);
    }];
}

-(void)setTitle:(NSString *)title
{
    _title = title;
    
    [_cancellButton setTitle:_title forState:UIControlStateNormal];
}

- (void)cancellButtonDidClick
{
    
}

- (UIButton *)cancellButton {
    if (_cancellButton == nil) {
        _cancellButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _cancellButton.backgroundColor = ColorHex(0xC0C0C0);
        [_cancellButton setTitle:@"退出当前帐号" forState:UIControlStateNormal];
        _cancellButton.titleLabel.font = [UIFont systemFontOfSize:14];
        _cancellButton.layer.cornerRadius = 7;
        _cancellButton.clipsToBounds = YES;
        [_cancellButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        //不接受点击事件
        _cancellButton.userInteractionEnabled = NO;
        [_cancellButton addTarget:self action:@selector(cancellButtonDidClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _cancellButton;
}


@end
